From: Philip Chimento Date: Thu, 7 Nov 2019 20:51:28 +0000 (-0800) Subject: power: Handle "100% but charging" case X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~447 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5fd52e99d39;p=gnome-shell.git power: Handle "100% but charging" case I've observed that UPower can occasionally report a charge level of 100% while the state is still "charging". This usually doesn't last very long but it is noticeable because the power icon changes to a "missing icon" icon. This will handle that rare case correctly. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/814 --- diff --git a/js/ui/status/power.js b/js/ui/status/power.js index 449f15917..76343d244 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -112,9 +112,12 @@ class Indicator extends PanelMenu.SystemIndicator { let chargingState = this._proxy.State == UPower.DeviceState.CHARGING ? '-charging' : ''; let fillLevel = 10 * Math.floor(this._proxy.Percentage / 10); - let icon = this._proxy.State == UPower.DeviceState.FULLY_CHARGED - ? 'battery-level-100-charged-symbolic' - : `battery-level-${fillLevel}${chargingState}-symbolic`; + let icon; + if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED || + fillLevel === 100) + icon = 'battery-level-100-charged-symbolic'; + else + icon = `battery-level-${fillLevel}${chargingState}-symbolic`; // Make sure we fall back to fallback-icon-name and not GThemedIcon's // default fallbacks